<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<title>应届大学生个人信息</title>
		<!--vue-->
		<script src="https://lib.baomitu.com/vue/2.6.14/vue.js"></script>
		<!--axios-->
		<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
		<!--element-->
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui@2.15.5/lib/theme-chalk/index.css">
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui@2.15.5/lib/index.js"></script>
		<style>

		</style>
	</head>
	<body>
		<!-- 页面渲染 -->
		<div id="app">
			<!-- 数据展示区 -->

			<div align="center">
				<el-form ref="form" :model="user" label-width="80px">
					<el-form-item label="角色名称">
						<el-input v-model="user.nickName"></el-input>
					</el-form-item>
					<el-form-item label="职业类型">
						<el-select v-model="user.jobName" placeholder="请选择"  style="width: 100%">
							<el-option
									v-for="item in jobList"
									:key="item"
									:label="item"
									:value="item">
							</el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="巅峰等级">
						<el-input v-model="user.peakLevel" type="number"></el-input>
					</el-form-item>

					<el-form-item label="面板伤害">
						<el-input v-model="user.dps" type="number"></el-input>
					</el-form-item>

					<el-form-item label="增伤加成">
						<el-input v-model="user.damageBonus" type="number"></el-input>
					</el-form-item>

					<el-form-item label="状态">
						<el-select v-model="user.status" placeholder="请选择" style="width: 100%">
							<el-option
									v-for="item in ['正常','请假','失联']"
									:key="item"
									:label="item"
									:value="item">
							</el-option>
						</el-select>
					</el-form-item>

					<el-form-item label="备注">
						<el-input v-model="user.remark"></el-input>
					</el-form-item>

					<el-form-item>
						<el-button type="primary" @click="onSubmit">保存</el-button>
						<el-button> <a href="zhanlibang.html" style="text-decoration:none"  >返回</a></el-button>
					</el-form-item>
				</el-form>
			</div>
		</div>

		<script>
			axios.defaults.baseURL = ""
			const app = new Vue({
				el: "#app",
				data: {
					user: {},
					jobList:["法师","死灵","野蛮人","圣教军","武僧","猎魔"]
				},
				methods: {
					// 查询所有数据
					getUser() {
						var url = window.location.href ;
						var dz_url = url.split('#')[0];
						var cs = dz_url.split('?')[1];
						var cs_arr = cs.split('&');
						var cs={};
						for(var i=0;i<cs_arr.length;i++){
							cs[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
						}
						let nickName=cs.nickName;
						axios.get("getUser?nickName="+nickName)
							.then(Promise => {
								this.user = Promise.data;

							})
					},
					onSubmit() {
						let uList=[];
						uList.push(this.user);
						axios.put("saveAll",uList)
								.then(Promise => {
									let msg = Promise.data
									this.$message({
										message: '保存成功',
										type: 'success'
									});
								})
					}
				},
				created() {
					this.getUser()
				}
			})
		</script>
	</body>
</html>
